import request from '../index.js'

// 获取商品分类
export const appletBasGoodsType = params => {
  return request.get('/api/appletBasGoodsType', params)
}

// 获取商品品牌
export const appletBasGoodsBrand = params => {
  return request.get('/api/appletBasGoodsBrand', params)
}
// 获取商品
export const appletBasGoods = params => {
  return request.get('/api/appletBasGoods', params)
}
//商品下拉接口
export const basGoodsListForAdd = params => {
  if(params.isSpecial === 1){
    return request.get('/api/dropDown/basGoodsListForAdd', params).catch(err=>{
      err.content.forEach(item=>{
        item.taxBoxPrice = item.promotionTaxBoxPrice
        item.taxPrice = item.promotionTaxPrice
        item.billTaxBoxPrice = item.promotionTaxBoxPrice
        item.billTaxPrice = item.promotionTaxPrice

      })
      return Promise.reject(err)
    })
  }else {
    return request.get('/api/dropDown/basGoodsListForAdd', params)
  }

}

// 获取售点门店
export const appletBasCustomerArea = params => {
  return request.get('/api/appletBasCustomerArea', params)
}

// 获取客户信息
export const appletBasCustomer = params => {
  return request.get('/api/appletBasCustomer', params)
}

// 提交商品数据
export const addOrSave = data => {
  return request.post('/api/appletMobileOrder/addOrSave', data)
}
// 提交商品数据访客
export const addOrSaves = data => {
  return request.post('/api/newCustomerVisitRecord/order', data)
}

// 保存客户详情 /api/appletBasCustomer/addOrSave
export const addOrSaveCustomer = data => {
  return request.post('/api/appletBasCustomer/addOrSave', data)
}
//商品品牌下拉接口
export const getBasGoodsBrandS = data => {
  return request.get('/api/dropDown/basGoodsBrandList', data)
}

//获取赠品清单条数
export const getBasCustomerTypeList = data => {
  return request.get('/api/dropDown/basCustomerTypeList', data)
}
//商品分类下拉接口
export const salesGiftListCount = data => {
  return request.get('/api/dropDown/salesGiftListCount', data)
}
//商品分类子节点下拉接口
export const childBasGoodsTypeList = data => {
  return request.get('/api/dropDown/childBasGoodsTypeList', data)
}

export const basGoodsTagList = data => {
  return request.get('/api/dropDown/basGoodsTagList', data)
}
//字典
export const getDict = data => {
  return request.get('/api/dropDown/dict/detail', data)
}
//客户列表
export const getbasCustomerList = data => {
  return request.get('/api/dropDown/basCustomerList', data)
}
//获取带促销的商品接口
export const basGoodsListForAddWithGiftPromotion = data => {
  return request.get('/api/dropDown/basGoodsListForAddWithGiftPromotion', data)
}

export const giftPromotionDetail= data => {
  return request.get('/api/dropDown/basGoodsListForAddWithGiftPromotion/detail', data)
}
//获取空箱接口
export const paperGoodsWithEmptyBoxGoodsList= data => {
  return request.get('/api/dropDown/paperGoodsWithEmptyBoxGoodsList', data)
}

// 提交商品数据
export const appletBasCustomerCreditAddOrSave = data => {
  return request.post('/api/appletBasCustomerCredit/addOrSave', data)
}

// 提交商品数据
export const appletSalesOrderAddOrSave = data => {

  return request.post('/api/appletSalesOrder/addOrSave', data)
}
//获取最近仓库
export const getNearbyWarehouse = data => {
  return request.get('/api/dropDown/getNearbyWarehouse', data)
}
// 提交库存数据
export const stockreport = data => {

  return request.post('/api/customerStock/report', data)
}
// 提交新库存数据
export const newstockreport = data => {

  return request.post('/api/newCustomerVisitRecord/report', data)
}

//提交协议
export const contract = data => {

  return request.post('/api/newCustomerVisitRecord/contract', data)
}

//获取科目
export const basSubjectList = data => {
  return request.get('/api/dropDown/basSubjectList', data)
}
//费用科目子节点
export const basSubject= (data) => {
	return request.get(`/api/dropDown/childBasSubjectList`,data)
}
//增加科目
export const addBasSubject = data => {

  return request.post('/api/api/basSubject/addOrSave', data)
}
